package com.fr.chart.plot;

import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.chart.base.equals.Equals;
import com.fr.chart.core.glyph.Pie3DPlotGlyph;
import com.fr.chart.core.glyph.PlotGlyph;
import com.fr.chart.legend.LineMarkerIcon;
import com.fr.chart.math.Object3D;
import com.fr.chart.math.Projection;
import com.fr.data.ChartData;

public class Pie3DPlot extends PiePlot
  implements Object3D
{
  private static final long serialVersionUID = -5601071892216143828L;
  private int depth = 20;
  private Projection projection = new Projection();

  public Pie3DPlot()
  {
    this.projection.setRotation(0);
    this.projection.setElevation(25);
    this.projection.setFocus(800);
  }

  public PlotGlyph createPlotGlyph(ChartData paramChartData)
  {
    Pie3DPlotGlyph localPie3DPlotGlyph = new Pie3DPlotGlyph();
    paramChartData = create65Data4New(paramChartData);
    install4PlotGlyph(localPie3DPlotGlyph, paramChartData);
    return localPie3DPlotGlyph;
  }

  public void install4PlotGlyph(Pie3DPlotGlyph paramPie3DPlotGlyph, ChartData paramChartData)
  {
    super.install4PlotGlyph(paramPie3DPlotGlyph, paramChartData);
    paramPie3DPlotGlyph.setDepth(this.depth);
    paramPie3DPlotGlyph.setProjection(this.projection);
  }

  protected void dealCondition(LineMarkerIcon paramLineMarkerIcon, int paramInt)
  {
    dealColorCondition(paramLineMarkerIcon, paramInt);
  }

  public void setDepth(int paramInt)
  {
    this.depth = paramInt;
  }

  public int getDepth()
  {
    return this.depth;
  }

  public void setProjection(Projection paramProjection)
  {
    this.projection = paramProjection;
  }

  public Projection getProjection()
  {
    return this.projection;
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    super.readXML(paramXMLableReader);
    if (paramXMLableReader.isChildNode())
    {
      String str1 = paramXMLableReader.getTagName();
      if ("Projection".equals(str1))
      {
        this.projection = ((Projection)paramXMLableReader.readXMLObject(new Projection()));
      }
      else if ("Depth".equals(str1))
      {
        String str2;
        if ((str2 = paramXMLableReader.getAttr("value")) != null)
          setDepth(Integer.parseInt(str2));
      }
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    paramXMLPrintWriter.startTAG("Plot");
    super.writeXML(paramXMLPrintWriter);
    paramXMLPrintWriter.startTAG("Depth").attr("value", getDepth()).end();
    if (this.projection != null)
      this.projection.writeXML(paramXMLPrintWriter);
    paramXMLPrintWriter.end();
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    Pie3DPlot localPie3DPlot = (Pie3DPlot)super.clone();
    if (this.projection != null)
      localPie3DPlot.projection = ((Projection)this.projection.clone());
    return localPie3DPlot;
  }

  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof Pie3DPlot))
      return false;
    Pie3DPlot localPie3DPlot = (Pie3DPlot)paramObject;
    if (!(super.equals(localPie3DPlot)))
      return false;
    if (localPie3DPlot.getDepth() != getDepth())
      return false;
    return (Equals.equals(localPie3DPlot.projection, this.projection));
  }
}